package com.kj.tms.common.bean.session;


import com.kj.tms.common.bean.exception.SessionException;

import java.util.Enumeration;

/**
 * session接口类
 */
public interface SessionHandle {

    /**
     * 设置session属性对
     * @param name key
     * @param value 值
     * @throws SessionException
     */
    void setAttribute(String name, Object value) throws SessionException;

    /**
     * 根据属性key获取value
     * @param name key
     * @return String 值
     * @throws SessionException
     */
    Object getAttribute(String name) throws SessionException;

    /**
     * 根据属性key删除属性对
     * @param name key
     * @throws SessionException
     */
    void removeAttribute(String name) throws SessionException;

    /**
     * 获取全部属性对
     * @return Enumeration 枚举数组
     * @throws SessionException
     */
    Enumeration<?> getAttributeNames() throws SessionException;

    /**
     * 使该session失效，删除sessionId下的所有name value
     * @throws SessionException
     */
    void invalidate() throws SessionException;

    /**
     * 获取sessionId
     * @return 获取sessionId
     */
    String getId();

    /**
     * 设置重置时间
     */
    void expire() throws SessionException;
}
